package weiyao.xinxidasai.pojo;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Date;



public class FilesFolder {
    private Long folderId;
    private Long userId;
    private String folderPath;
    private Date createTime;

    public Long getFolderId() {
        return folderId;
    }

    public void setFolderId(Long folderId) {
        this.folderId = folderId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getFolderPath() {
        return folderPath;
    }

    public void setFolderPath(String folderPath) {
        this.folderPath = folderPath;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public FilesFolder(Long folderId, Long userId, String folderPath, Date createTime) {
        this.folderId = folderId;
        this.userId = userId;
        this.folderPath = folderPath;
        this.createTime = createTime;
    }

    public FilesFolder() {
    }

    public String getName() {
        if (folderPath.equals("/")) return "根目录";
        return folderPath.substring(folderPath.lastIndexOf('/') + 1);
    }
}
